﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yxinmt.Interface;

namespace Yxinmt.Components
{
    public class InkCanvasComponent : BaseComponent, IComponent
    {
        Controls.InkCanvas _InkCanvas { get; set; }

        public InkCanvasComponent(Dictionary<string, object> property, IWindow form)
        {
            _Property = property;
            Window = form;
            this.InitSet();

            this.ControlList = new List<IControl>();

            _InkCanvas = new Controls.InkCanvas(_Property, this);
            this.ControlList.Add(_InkCanvas);

            LoadView();
        }

        public void LoadView(Dictionary<string, object> view = null)
        {
            if (view != null) _Property["properties"] = new List<Dictionary<string, object>>() { view };
            ComponentList = new List<IComponent>();
            SetView();

            _InkCanvas.Clear();
            this.GetComponentsElements().ForEach(c => _InkCanvas.Add(c));
        }
    }
}
